import re

PATTERN = {
       'real':re.compile(r'(?<![\w%s])\d+\.\d+(?![\w%s])'%(re.escape(r'''.%&)]}#?\$'"'''), re.escape(r'''.%&([{#?\$'''))),
       'integer':re.compile(r'(?<![\w%s])\d+(?![\w.%s])'%(re.escape(r'''.%&)]}#?\$'"'''), re.escape(r'''.%&([{#?\$'''))),
       'variable':re.compile(r'(?<![\w.\&])[a-zA-Z_]\w*(?![\w\(])'),
       'function':re.compile(r'(?<![\w.\&])[a-zA-Z_]\w*(?=[\(])'),
       'string_qualifier':re.compile(r'''(?<!['"])("|'|"""|\'\'\')(?!['"])'''),
       'eos':re.compile(r'(?<![\s\\])\s*[\n|;]'),#end of statement
       'eol':re.compile(r'\s*\n'),#end of line
       'multiline':re.compile(r'\\\s*\n'),
       'assignment':re.compile(r'(?<!=)\s*=\s*(?!=)'),
       'listIndices':re.compile(r'(?<!in)(?<=\w)(\s*\[[\w\s\+\-\*]*(\<string\>.*\</string\>)*[\w\s\+\-\*]*\]\s*)+(?![\[\s])'),
       'tag':re.compile(r'<.*?>'),
       }

parsers = {}

import html_parser, number_parser, statement_parser, \
        string_parser, export_parser, sympy_parser, sympyplot_parser

parsers['export'] = export_parser.Exporter()
parsers['html'] = html_parser.HtmlParser()
parsers['number'] = number_parser.NumberParser()
parsers['statement'] = statement_parser.StatementParser()
parsers['string'] = string_parser.StringParser()
parsers['sympy'] = sympy_parser
parsers['plot'] = sympyplot_parser.PlotParser()
